Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Monitor  File  Modification  

 Content of Monitor File Modification.vbs
MD5 Hash: 2140138203DB0EE6981ACC914388D64A
' Description: Temporary event consumer that issues an alert any time the file C:\Scripts\Index.vbs is modified. Best when run under Cscript.exe.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceModificationEvent WITHIN 10 WHERE " _
& "TargetInstance ISA 'CIM_DataFile' and " _
& "TargetInstance.Name='c:\\scripts\\index.vbs'")

Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo "File: " & objLatestEvent.TargetInstance.Name
Wscript.Echo "New size: " & objLatestEvent.TargetInstance.FileSize
Wscript.Echo "Old size: " & objLatestEvent.PreviousInstance.FileSize
Loop

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a